package StudyCode.summary.mycollection;

import java.util.Random;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ShuffleTwoDimensionalArray {
	public static <T> T[][] shuffle(T[][] input) {
		int j;
		Random seed = new Random(System.nanoTime());
		T[][] cloned = input.clone();
		for (int i = cloned.length - 1; i > 0; i--) {
			j = seed.nextInt(i);
			for (int k = 0; k < cloned[i].length; k++) {
				T c = cloned[i][k];
				cloned[i][k] = cloned[j][k];
				cloned[j][k] = c;
			}
		}
		return cloned;
	}
}
